#注册表单页面
from selenium.webdriver.common.by import By

from utils.page_base import PageBase

class PageRegForm(PageBase):
    url="/webzdh/form.html"
    loc_zanhao=By.ID,"username"
    loc_pwd=By.ID,"pwd"
    loc_sex="sex" #对于单选按钮控件，给name属性的值
    loc_guoji="guoji"
    loc_aihao="aihao" #对于复选框控件，给name属性的值
    loc_degree="degree" #对于下拉列表控件，给select标签的name属性的值
    loc_jiesao=By.ID,"jiesao"
    loc_zaopian=By.ID,"zaopian"
    loc_birthday=By.ID,"birthday"
    loc_regButton=By.CSS_SELECTOR,"input[type='submit'][value='注册']"

    def __init__(self,driver,base_url):
        PageBase.__init__(self,driver,base_url)


    def openUrl(self):
        self.open(PageRegForm.url)

    def input_zanhao(self,zanhao):
        self.input(PageRegForm.loc_zanhao,zanhao)

    def input_pwd(self,pwd):
        self.input(PageRegForm.loc_pwd,pwd)

    def input_sex(self,sex):#value属性
        self.click_radio(PageRegForm.loc_sex,sex)

    def input_guoji(self,guoji):#value属性
        self.click_radio(PageRegForm.loc_guoji,guoji)

    def input_aihao(self,aihaos):#逗号分隔的values
        self.click_checkbox(PageRegForm.loc_aihao,aihaos)

    def input_degree(self,degree):#选项的文本内容
        self.click_select(PageRegForm.loc_degree,degree)

    def input_jiesao(self,jiesao):
        self.input(PageRegForm.loc_jiesao,jiesao)

    def input_zaopian(self,zaopianPaths):#逗号分隔的文件路径
        # self.uploadFileorDirs1(PageRegForm.loc_zaopian,zaopianPaths)
        self.uploadFileorDirs2(PageRegForm.loc_zaopian,zaopianPaths)

    def input_birthday(self,birthday):
        self.input_riqi(PageRegForm.loc_birthday,birthday)

    def click_regButton(self):
        self.click(PageRegForm.loc_regButton)

    def getRegSuccessTips(self): #"注册成功"
        return self.getTextForJsTanCuKuan()

    def clickJsAcceptButton(self):
        self.acceptForJsTanCuKuan()






